<%@ page import="com.dingpeikeji.quickdeer.core.modules.sys.entity.Office" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="FLAT_TYPE_BUS" value="<%=Office.FLAT_TYPE_BUS %>"></c:set>
<c:set var="FLAT_TYPE_ENTERPRISE" value="<%=Office.FLAT_TYPE_ENTERPRISE %>"></c:set>
<html>
<head>
	<title>企业用户管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active">
			<a href="javascript:void(0);">企业用户列表</a>
		</li>
	</ul>
	<!-- 拼接表单提交地址 -->
	<form:form id="searchForm" modelAttribute="office" action="${ctx}/sys/office/genList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		 <ul class="ul-form">
			<li><label class="control-label">归属区域：</label>
				<sys:treeselect id="area" name="area.id" value="${office.area.id}"
					labelName="area.name" labelValue="${office.area.name}" title="区域" 
					url="/sys/area/treeData"  notAllowSelectParent="true" allowClear="true" cssClass="input-small" />
			</li>
			<li><label>公司全称：</label>
				<form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li><label>使用状态：</label>
				<form:select path="useable" class="input-medium">
					<option value="">--请选择--</option>
					<form:options items="${fns:getDictList('userable')}" itemLabel="label" itemValue="value" htmlEscape="false" />
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul> 
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>所属城市</th>
				<th>企业名称</th>
				<th>联系人</th>
				<th>联系人手机</th>
				<th>使用状态</th>
				<!-- <th>联系地址</th> -->
				<shiro:hasPermission name="sys:office:upedit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="office">
			<tr>
				<td>${office.area.name}</td>
				<td>${office.name}</td>
				<td>${office.operator}</td>
				<td>${office.operatortel}</td>
				<td>${fns:getDictLabel(office.useable, 'userable', '无')}</td>
				<shiro:hasPermission name="sys:office:upedit"><td>
    				<a href="${ctx}/sys/office/genform?id=${office.id}">升级</a>
    				<c:if test="${office.useable == 1 }"> 
    				<a href="${ctx}/sys/office/disableup?id=${office.id}" onclick="return confirmx('确认要停用吗？', this.href)">停用</a>
    				</c:if>
    				<c:if test="${office.useable == 0 }">
    				<a href="${ctx}/sys/office/enableOffice?id=${office.id}&list=${list}" onclick="return confirmx('确认要启用吗？', this.href)">启用</a>
    				</c:if>
    				<%-- <c:choose>
			<c:when test="${office.flatType == FLAT_TYPE_BUS }"><a href="${ctx}/sys/office/delete?id=${office.id}" onclick="return confirmx('确认要停用吗？', this.href)">停用</a></c:when>
			<c:when test="${office.flatType == FLAT_TYPE_ENTERPRISE }"><a href="${ctx}/sys/office/delete?id=${office.id}" onclick="return confirmx('确认要删除吗？', this.href)">删除</a></c:when>
			<c:otherwise>未知</c:otherwise>
			</c:choose> --%>
					
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>